import PyPDF2
import re
import string
frequency = {}
pdfFileObj = open('C:\\Users\\sword\\Desktop\\Fish-v327\\kpdf\\20184.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
for pageNum in range(0, 5):
    pageObj = pdfReader.getPage(pageNum)
    text_string = pageObj.extractText().lower()
    match_pattern = re.findall(r'\b[a-z]{4,15}\b', text_string)
    for word in match_pattern:
        count = frequency.get(word, 0)
        frequency[word] = count+1
    l = []

for a, b in frequency.items():
    l.append((b, a))
    l.sort(reverse=True)
for words, frequency[words] in l:
    print(frequency[words])






